﻿@{
    ViewBag.Title = "Index";
    Layout = null;
}

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, minimum-scale= 1.0, initial-scale= 1.0">
    <link href="~/Content/Style/conmon.css" rel="stylesheet" type="text/css">
    <link href="~/Content/fonts/iconfont.css" rel="stylesheet" type="text/css">
    @*<link rel="stylesheet" href="~/Content/swiper/swiper-4.3.3.min.css">*@
    <link href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.7/css/swiper.min.css" rel="stylesheet">
    <!-- Include the Swiper library -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.7/js/swiper.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <!-- Swiper JS Vue -->
    <script src="https://cdn.jsdelivr.net/npm/vue-awesome-swiper@3.1.2/dist/vue-awesome-swiper.js"></script>
    <title>购物车</title>
    <style>
        .summary {
            padding-bottom: 56px;
        }

        .rating-wrapper {
        }

        .Choice.active i {
            color: #FF6700
        }

        .rating-wrapper .rating-item {
            display: flex;
            border-bottom: 1px solid rgba(7, 17, 27, 0.1);
            position: relative;
        }

            .rating-wrapper .rating-item .del {
                bottom: 22px;
                right: 12px;
                position: absolute;
            }

            .rating-wrapper .rating-item .avatar {
                flex: 0 0 150px;
                margin-right: 12px;
                padding-right: 12px;
            }

                .rating-wrapper .rating-item .avatar .Choice {
                    display: inline-block;
                    line-height: 120px;
                    vertical-align: top;
                    padding-left: 4px;
                    padding-right: 4px;
                }

                    .rating-wrapper .rating-item .avatar .Choice i {
                        font-size: 28px;
                        color: #f3f5f7;
                    }

                    .rating-wrapper .rating-item .avatar .Choice.active i {
                        color: #FF6700
                    }

            .rating-wrapper .rating-item .content_sum {
                padding: 20px 0;
                position: relative;
                flex: 1;
            }

                .rating-wrapper .rating-item .content_sum .name {
                    margin-bottom: 4px;
                    line-height: 12px;
                    font-size: 10px;
                    color: rgb(7, 17, 27);
                }

                .rating-wrapper .rating-item .content_sum .star-wrapper {
                    margin-bottom: 6px;
                    font-size: 0;
                }

                    .rating-wrapper .rating-item .content_sum .star-wrapper .star {
                        display: inline-block;
                        margin-right: 6px;
                        vertical-align: top;
                    }

                    .rating-wrapper .rating-item .content_sum .star-wrapper .delivery {
                        display: inline-block;
                        vertical-align: top;
                        line-height: 12px;
                        font-size: 10px;
                        color: rgb(147, 153, 159);
                    }

                .rating-wrapper .rating-item .content_sum .text {
                    margin-bottom: 8px;
                    line-height: 18px;
                    color: rgba(0,0,0,.54);
                    font-size: 12px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    display: -webkit-box;
                    -webkit-line-clamp: 3;
                    -webkit-box-orient: vertical;
                }

                .rating-wrapper .rating-item .content_sum .recommend {
                    line-height: 16px;
                    font-size: 0;
                }

                    .rating-wrapper .rating-item .content_sum .recommend .icon-thumb_up,
                    .rating-wrapper .rating-item .content_sum .recommend .item {
                        display: inline-block;
                        margin: 0 8px 4px 0;
                        font-size: 9px;
                    }

                    .rating-wrapper .rating-item .content_sum .recommend .icon-thumb_up {
                        color: rgb(0, 160, 220);
                    }

                    .rating-wrapper .rating-item .content_sum .recommend .item {
                        padding: 0 6px;
                        border: 1px solid rgba(7, 17, 27, 0.1);
                        border-radius: 1px;
                        color: rgb(147, 153, 159);
                        background: #fff
                    }

        footer .footer_box {
            height: 100%;
        }

            footer .footer_box .footer_li.flex {
                flex: 0 0 60%;
                background-color: #FF6700;
            }

                footer .footer_box .footer_li.flex .orderText {
                    color: #fff;
                    line-height: 56px;
                }
        .footer_li{
            height:56px;
            line-height:56px;
        }
            .footer_li:nth-child(1) {
                background-color: #fff;
                color: #B5B5B5;
            }
        footer .footer_box .footer_li:nth-child(1) span{
            color: #FF5722;
            font-size: 20px;
        }
                .footer_li:nth-child(2) {
                    background-color: #F4F4F4;
                }
                .footer_li:nth-child(2) a {
                    color: #333333;
                }
                .footer_li:nth-child(3) {
                    background-color: #FF6700;
                }
                .footer_li:nth-child(3) a {
                    color: #fff;
                }
                .quantity {
                    display: inline-block;
                    vertical-align: top;
                    width: 30px;
                    margin-top: 3px;
                    text-align: center;
                }


    </style>
</head>
<body>
    <div id="app">
        <div class="summary">
            <div class="content_sum">
                <div>
                    <div class="rating-wrapper content">
                        <div v-if="0">
                            <div><div class="Choice" :class="{'active':activeAllFaL}" v-on:click="activeAll(true)"><i class="iconfont icon-dingdanzhuangtai-yiwancheng"></i>全选</div></div>
                            <div><div class="Choice" v-on:click="activeAll(false)">取消全选{{totaMoney}}</div></div>
                        </div>

                        <ul>
                            <li class="rating-item" v-for="item in rows">
                                <a href="javascript:;">
                                    <div class="avatar">
                                        <div class="Choice" :class="{'active':item.active}" v-on:click="selectedProduct(item)"><i class="iconfont icon-dingdanzhuangtai-yiwancheng"></i></div>
                                        <img width="80" height="80" src="/Content/images/bg02.jpg" style="margin-top:20px;">
                                        <div class="content_sum" style="display: inline-block;vertical-align: top;padding-left:12px;">
                                            <h1 class="title">吃饭</h1>
                                            <p class="text">睡觉</p>
                                            <div class="price">
                                                <span class="now">￥{{item.Price}}</span><span class="old" v-if="0">￥</span>
                                            </div>
                                            <div style="font-size:18px;" class="number">
                                                <i class="iconfont icon-jian" style="font-size:24px;" v-on:click="Number(item,-1)"></i>
                                                <input type="type" name="name" value="" v-model="item.number" class="quantity" />
                                                <i class="iconfont icon-tianjia" style="font-size:24px;" v-on:click="Number(item,1)"></i>
                                            </div>
                                        </div>
                                    </div>
                                </a>
                                <div style="font-size:18px;" class="del">
                                    <i class="iconfont icon-delIcon" style="font-size:22px;color: #B5B5B5;"></i>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <footer>
            <div class="footer_box">
                <div class="footer_li">
                    金额:<span>{{totaMoney}}</span>
                </div>
                <div class="footer_li">
                    <a href="/Classification/Index">
                        <span>继续购物</span>
                    </a>
                </div>
                <div class="footer_li">
                    <a href="/Classification/ShoppingCart">
                        <span>确认下单</span>
                    </a>
                </div>
            </div>
        </footer>        
    </div>
    <script src="~/Content/Script/jquery-1.8.3.min.js"></script>
    <!-- 引入 Vue -->
    <script src="https://unpkg.com/vue"></script>
    <script>

        var vm = new Vue({
            el: '#app',
            data() {
                return {
                    activeAllFaL: false,
                    totaMoney:0,
                    rows: [
                        {
                            number: 1,
                            TotalAmount: '',
                            Price: 999,
                        },
                        {
                            number: 1,
                            TotalAmount: '',
                            Price: 2.00,
                        }
                    ]


                };
            },
            created() {
            },
            methods: {
                Number(item, a) {
                    if (a > 0) {
                        item.number++;
                    }
                    if (a < 0) {
                        item.number--;
                        if (item.number < 1) {
                            item.number = 1;
                        }
                    }
                    this.AmountCalculation();
                },
                selectedProduct(item) {
                    if (typeof item.active == 'undefined') {
                        this.$set(item, "active", true)
                    } else {
                        item.active = !item.active;
                    }
                    this.AmountCalculation();
                    console.log(item);
                },
                activeAll(FaLg) {
                    var _this = this;
                    _this.activeAllFaL = FaLg;
                    _this.rows.forEach(function (item, index) {
                        if (typeof item.active == 'undefined') {
                            _this.$set(item, "active", FaLg)
                        } else {
                            item.active = FaLg;
                        }
                    });
                    this.AmountCalculation();
                },
                AmountCalculation() {
                    var _this = this;
                    _this.totaMoney = 0;
                    _this.rows.forEach(function (item, index) {
                        if (item.active) {
                            _this.totaMoney += item.number * item.Price;
                        }
                    });
                }

            }
        });
    </script>
</body>
</html>
